package com.swq.java.code.chapter10.code02;

class Base {
    static int a = 1;

    static {
        System.out.println("init Base");
    }

    static void method() {
        System.out.println("method of Base");
    }
}

class Sub extends Base {
    static {
        System.out.println("init Sub");
    }
}

public class Sample {
    public static void main(String args[]) {
        System.out.println("a=" + Sub.a);  //仅仅初始化Base类
        Sub.method();
    }
}